<?php

include_once "configa.php";

$character = $_POST['character'];

if (isset($character)) {

    if ($db = @mysql_connect($dbhost, $dbuser, $dbpass))
    {
        mysql_select_db($dbwname, $db);
        $result = mysql_query('SELECT * FROM `characters` WHERE `name`="'.$character.'"', $db);
        
        while ($row = mysql_fetch_assoc($result)) {
            $acct = $row['acct'];
        };
    
    }
    mysql_close($db);

    if ($db = @mysql_connect($dbhost, $dbuser, $dbpass))
    {
        mysql_select_db($dbcname, $db);
        mysql_query('UPDATE `accounts` SET `banned`= "1" WHERE `acct`="'.$acct.'"', $db);
    }
    mysql_close($db);

echo '<center>Account Banned!</center>';
}

?>

<form action="ban.php" method="post">
<div align="center">
    <table border="0" cellpadding="0" cellspacing="0" width="250">
        <tr>
            <td>
            <p align="center"><input type="text" name="character" size="20"></td>
        </tr>
        <tr>
            <td>
            <p align="center"><input type="submit" value="Ban!" name="ban"></td>
        </tr>
    </table>
</div>
</form>